package maopao_order;


import java.util.Arrays;

class Test {
    public static void main(String[] args) {
        //相邻的两个元素进行比较，每次冒泡都可以选出一个最大值或者最小值
        long startTime = System.currentTimeMillis();
        int[] arry = {1, 3, 5, 6, 3, 7, 8, 2, 6, 7, 7, 5, 4, 4, 5, 5, 5, 44
                , 3, 5, 6, 3, 7, 8, 2, 6, 7, 7, 5, 4, 4, 5, 5, 5, 44};
        int length = arry.length;
        for (int i = 0; i < length - 1; i++) {
            for (int j = 0; j < length - i -1; j++) {
                if (arry[j] > arry[j + 1]) {
                    int temp = arry[j + 1];
                    arry[j +1] = arry[j];
                    arry[j] = temp;
                }
            }

        }
        for (int a :
                arry) {
            System.out.printf("%d ", a);
        }
        long endTime = System.currentTimeMillis();
        System.out.println("\n" + (endTime - startTime) + "ms");
    }
}

public class Solution {
}
